import withAuth from '../../../helpers/basicAuth';
import { getInputByLabel } from '../../../helpers/formHelpers';

import {
    assertNextDisabledAndHelperTextError,
    assertReportsTable,
    clickCancelAndConfirmInWizard,
    clickCreateReport,
    // clickNextToWizardStep2,
    // clickNextToWizardStep3,
    visitVulnerabilityReports,
} from './VulnerabilityReporting.helpers';

describe('Vulnerability Reports table', () => {
    withAuth();

    it('should display table head cells', () => {
        visitVulnerabilityReports();

        cy.get('th:contains("Report")');
        cy.get('th:contains("Collection")');
        cy.get('th:contains("Description")');
        cy.get('th:contains("My last job status")');
    });

    it('should open wizard and then cancel', () => {
        visitVulnerabilityReports();
        clickCreateReport();

        const reportName = 'wizard test';
        const description = 'should open wizard and then cancel';

        // Step 1
        cy.get('h2:contains("Configure report parameters")');
        getInputByLabel('Report name').type(reportName);
        getInputByLabel('Report description').type(description);
        assertNextDisabledAndHelperTextError('A collection is required');
        // TODO mock collection to select

        /*
        // Step 2
        // TODO mock notifier to select
        clickNextToWizardStep2();
        cy.get('h2:contains("Configure delivery destinations")');

        // Step 3
        clickNextToWizardStep3();
        cy.get('h2:contains("Review")');
        */

        clickCancelAndConfirmInWizard();
        assertReportsTable();
    });
});
